#include<math.h>
#include "Segment.h"


Segment::Segment(Point C, Point D)
{
  this->A.x = C.x;
  this->B.x = D.x;
  this->A.y = C.y;
  this->B.y = D.y;
  this->panta = (D.y - C.y) / (D.x - C.x);
  this->afix = C.y - C.x * (D.y - C.y) / (D.x - C.x);
}


double Segment::lungime() const
{
  return sqrt((this->A.x - this->B.x) * (this->A.x - this->B.x) + (this->A.y - this->B.y) * (this->A.y - this->B.y));
}
